import React,{Suspense} from 'react';
import {unstable_createResource as createResource} from 'react-cache';

const getName = ()=>{
    return new Promise(resolve=>{
        setTimeout(()=>{resolve('wjk')},3000);
    })
};

const resource = createResource(getName);

const Greeting = ()=>{
    return <div>hello {resource.read()}</div>
};


export default ()=>{
    return(
        <Suspense fallback={<div>loading.......</div>}>
            <Greeting/>
        </Suspense>
    )
}